package com.golxen.framework.user.player;


import com.golxen.framework.executor.GeneralTask;
import com.golxen.utils.LogUtil;

public class PlayerDataSaveTask extends GeneralTask {

    private int saveIndex;

    private boolean saving = false;

    public PlayerDataSaveTask(int saveIndex) {
        this.saveIndex = saveIndex;
    }

    @Override
    public void doRun() {
        if (!saving) {
            saving = true;
            try {
                GamePlayerMgr.timeSave(saveIndex);
            } catch (Exception e) {
                LogUtil.COMMON.error("save user data error:", e);
            } finally {
                saving = false;
            }
        }
    }

}
